package com.glasses.business.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.glasses.business.R;
import com.glasses.business.event.BussEvent;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import de.greenrobot.event.EventBus;

/**
 * Author：邓勇军
 * English Name：Deng,The Sky Fucker!
 * Email：dandycoder@126.com
 * Date：2017/3/10
 * Version：1.0
 */

public class BackMoneyActivity extends Activity {
    @InjectView(R.id.back_img)
    ImageView backImg;
    @InjectView(R.id.title_tv)
    TextView titleTv;
    @InjectView(R.id.backContinue)
    TextView backContinue;
    private int id;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
//                WindowManager.LayoutParams.FLAG_FULLSCREEN);  //全屏
        setContentView(R.layout.activity_back_money);
        ButterKnife.inject(this);
        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this);
        }
        titleTv.setVisibility(View.VISIBLE);
        titleTv.setText("售后申请");
        if (getIntent() != null) {
            id = getIntent().getIntExtra("id", 0);
        }
    }

    public void onEventMainThread(BussEvent event) {
        if (event.getState() == BussEvent.Order_Refush) {
            finish();
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }

    @OnClick({R.id.back_img, R.id.backContinue})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.back_img:
                finish();
                break;
            case R.id.backContinue:
                Intent intent = new Intent(this, BackMoneyActivity_.class);
                intent.putExtra("id", id);
                startActivity(intent);
                break;
        }
    }
}
